package com.xxxx.service.impl;

import com.xxxx.dao.DoorDao;
import com.xxxx.pojo.Door;
import com.xxxx.service.DoorService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created By ShaoXikai on 2022/7/23
 */
@Service
public class DoorServiceImpl implements DoorService {

    private DoorDao doorDao;

    public void setDoorDao(DoorDao doorDao) {
        this.doorDao = doorDao;
    }

    @Override
    public List<Door> findAll() {
        return doorDao.selectAll();
    }

    @Override
    public Door findById(Long id) {
        return doorDao.selectById(id);
    }

    @Override
    public Door findByName(String name) {
        return doorDao.selectByName(name);
    }

    @Override
    public int modify(Door door) {
        return doorDao.update(door);
    }

    @Override
    public int save(Door door) {
        return doorDao.insert(door);
    }

    @Override
    public int remove(Long id) {
        return doorDao.deleteById(id);
    }
}
